﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="list.aspx.vb" Inherits="WebApplication3.list" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="Button1" runat="server" Text="Add New" 
            PostBackUrl="~/addNewRestaurant.aspx" />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="ID" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:HyperLinkField DataNavigateUrlFields="ID" 
                    DataNavigateUrlFormatString="restaurantDetails.aspx?ID={0}" 
                    DataTextField="RName" />
                <asp:HyperLinkField DataNavigateUrlFields="RAddress" 
                    DataNavigateUrlFormatString="http://maps.google.co.uk/maps?q={0}" 
                    DataTextField="RAddress" />
                <asp:HyperLinkField DataNavigateUrlFields="RWebsite" 
                    DataNavigateUrlFormatString="{0}" DataTextField="RName" HeaderText="Website" />
                <asp:BoundField DataField="AveragePriceInPounds" 
                    HeaderText="AveragePriceInPounds" SortExpression="AveragePriceInPounds" />
                <asp:BoundField DataField="Tel" HeaderText="Tel" SortExpression="Tel" />
                <asp:ImageField DataImageUrlField="RPicture" HeaderText="Thumbnails">
                    <ControlStyle Height="150px" Width="150px" />
                </asp:ImageField>
                <asp:TemplateField HeaderText="MichelinStars" SortExpression="MichelinStars">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("MichelinStars") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <ol>
                        <li><asp:Label ID="Label1" runat="server" Text='<%# Bind("MichelinStars") %>'></asp:Label> </li>
                        <li><asp:Label ID="Label2" runat="server" Text='<%# Bind("RWebsite") %>'></asp:Label></li>
                        </ol>


                        
                         

                        

                           
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:RestaurantConnection %>" 
            ProviderName="<%$ ConnectionStrings:RestaurantConnection.ProviderName %>" 
            
            SelectCommand="SELECT [ID], [RName], [RAddress], [RWebsite], [RPicture], [AveragePriceInPounds], [Tel], [MichelinStars] FROM [Restaurants] ORDER BY [ID] DESC">
        </asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
